package com.julu.appcloud.core.base;


import com.julu.appcloud.core.security.shiro.realm.AuthRealm;
import com.julu.appcloud.modules.system.entity.User;
import com.julu.appcloud.modules.system.service.*;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;

public class BaseController {

    public User getCurrentUser() {
        AuthRealm.ShiroUser shiroUser = (AuthRealm.ShiroUser) SecurityUtils.getSubject().getPrincipal();
        if (shiroUser == null) {
            return null;
        }
        User loginUser = userService.selectById(shiroUser.getId());
        return loginUser;
    }

    @Autowired
    protected UserService userService;

    @Autowired
    protected SiteService siteService;

    @Autowired
    protected MenuService menuService;

    @Autowired
    protected RoleService roleService;

    @Autowired
    protected LogService logService;
    
    @Autowired
    protected DictService dictService;
}
